package com.purong.purong.activity;

import android.view.View;
import android.widget.TextView;

import com.purong.purong.R;
import com.purong.purong.bean.BankLoanDetBean;

/**
 * Created by zengwenjie on 2017/11/22.
 */
public class BankLoanRateActivity extends BaseActivity {
    private TextView month,oneTime,rate,fee,advance;
    private BankLoanDetBean detBean;
    @Override
    public int getRootViewId() {
        return R.layout.activity_bank_loan_rate;
    }

    @Override
    public void initView() {
        month=(TextView)findViewById(R.id.month);
        oneTime=(TextView)findViewById(R.id.onetime);
        rate=(TextView)findViewById(R.id.rate);
        fee=(TextView)findViewById(R.id.fee);
        advance=(TextView)findViewById(R.id.advance_repay);

    }

    @Override
    public void initBundle() {
        detBean=(BankLoanDetBean)getIntent().getSerializableExtra("LOAN_DET");
    }

    @Override
    public void initData() {
        if (detBean!=null){
            month.setText(detBean.getMin_period()+"-"+detBean.getMax_period());
            oneTime.setText(detBean.getNonrecurring_rate()+"%");
            if (detBean.getRate_info().getMin_fee().equals(detBean.getRate_info().getMax_fee())){
                fee.setText(detBean.getRate_info().getMax_fee()+"%");
            }else {
                fee.setText(detBean.getRate_info().getMin_fee()+"%-"+detBean.getRate_info().getMax_fee()+"%");
            }
            if (detBean.getRate_info().getMin_rate().equals(detBean.getRate_info().getMax_rate())){
                rate.setText(detBean.getRate_info().getMax_rate()+"%");
            }else {
                rate.setText(detBean.getRate_info().getMin_rate()+"%-"+detBean.getRate_info().getMax_rate()+"%");
            }
            advance.setText(detBean.getAdvance_repay());
        }
    }
    public void onClick(View v){
        switch (v.getId()){
            case R.id.close:
                this.finish();
                break;
        }
    }
}
